package com.china08.yxyapi.rabbitmq.listener.esbag;

import java.util.HashMap;

import org.springframework.amqp.rabbit.annotation.EnableRabbit;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.china08.yxyapi.config.RabbitConfig;
import com.china08.yxyapi.service.manage.stu.mystudy.homework.dowork.impl.HomeworkServiceImpl;
import com.china08.yxyapi.service.manage.stu.mystudy.homework.dowork.impl.HomeworkServiceImplv01;

/**
 * 接受电子书包中发过来的数据
 *
 */
@Component
@EnableRabbit
public class EbagPostHomeWorkListener {

    @Autowired
    HomeworkServiceImpl homeworkServiceImpl;
    @Autowired
    HomeworkServiceImplv01 homeworkServiceImplv01;

    /**
     * @param 接受电子书包中发过来的数据
     */
    @RabbitListener(queues = RabbitConfig.STU_EBAG_STUDENT_POST_HOMEWORK)
    private void esbagToHomeWorkForPost(HashMap<String, String> MqMap) {
        homeworkServiceImpl.ebagCommitHomeWork(MqMap.get("studentId"), MqMap.get("taskId"), MqMap.get("homeWorkType"));
    }

    /**
     * @param 接受电子书包中发过来的数据
     */
    @RabbitListener(queues = RabbitConfig.STU_EBAG_STUDENT_POST_HOMEWORK_V01)
    private void esbagToHomeWorkForPostV01(HashMap<String, String> MqMap) {
        homeworkServiceImplv01.ebagCommitHomeWork(MqMap.get("studentId"), MqMap.get("taskId"),
                MqMap.get("homeWorkType"));
    }

}
